<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%--
  Created by IntelliJ IDEA.
  User: SXLWTT
  Date: 2021/11/4
  Time: 14:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="/js/jquery-1.9.1.min.js"></script>
    <script src="/js/fileupload.js"></script>
    <link rel="stylesheet" href="/bootstrap-4.6.0-dist/css/bootstrap.min.css">
</head>
<body>
<form action="/list.do" method="post">
    <input type="hidden" name="pageNum">
    收货单号:<input type="text" name="rodd" value="${map.rodd}" >
    制单时间：<input type="text" name="zdateX" value="${map.zdateX}" >--
    <input type="text" name="zdateD" value="${map.zdateD}" >
    <br>收货时间：<input type="text" name="rdateX" value="${map.rdateX}" >--
    <input type="text" name="rdateD" value="${map.rdateD}" >
    <br>优先级范围：<input type="text" name="priortyX" value="${map.priortyX}" >--
    <input type="text" name="priortyD" value="${map.priortyD}" >
    客户模糊：<input type="text" name="kname" value="${map.kname}" >
    客户发单号：<input type="text" name="clist" value="${map.clist}" >
    <br>制单人模糊：<input type="text" name="zname" value="${map.zname}" >
    制单人工号：<input type="text" name="zjob" value="${map.zjob}" >
    备注：<input type="text" name="remark" value="${map.remark}" >
    优先级排序：<select name="elems">
    <option value="">请选择</option>
    <option value="asc">正序</option>
    <option value="desc">倒序</option>
</select>
    <input type="submit" value="查询"><a href="/list.do">刷新</a>
</form>
<table class="table table-hover">
    <tr>
        <td>ID</td>
        <td>收货单号</td>
        <td>收货日期</td>
        <td>优先级</td>
        <td>状态</td>
        <td>递送条款</td>
        <td>制单人</td>
        <td>制单人工号</td>
        <td>制单时间</td>
        <td>备注</td>
        <td>客户</td>
        <td>附件图片</td>
        <td>发货单列表</td>
        <td>总重量</td>
        <td>操作</td>
    </tr>

    <c:forEach items="${pageInfo.list}" var="li">
        <tr>
            <td>${li.rid}</td>
            <td>${li.rodd}</td>
            <td>${li.rdate}</td>
            <td>${li.priorty}</td>
            <td>${li.flag}</td>
            <td>${li.terms}</td>
            <td>${li.zname}</td>
            <td>${li.zjob}</td>
            <td>${li.zdate}</td>
            <td>${li.remark}</td>
            <td>${li.kname}</td>
            <td>
                    <img src="${li.pic}" width="80px">
            </td>
            <td>${li.clist}</td>
            <td>${li.total}</td>
            <td>

                <c:if test="${li.flag!='已取消'}">
                    <input type="button" value="取消" onclick="qx(${li.rid})">
                </c:if>


                <c:if test="${li.flag=='已取消'}">
                    已取消
                </c:if>
            </td>
        </tr>
    </c:forEach>
    <tr>
        <td colspan="21">
            <a href="javaScript:qwe(1)">首页</a>
            <a href="javaScript:qwe(${pageInfo.isFirstPage?1:pageInfo.prePage})">上一页</a>
            <c:forEach items="${pageInfo.navigatepageNums}" var="index">
                <a href="javaScript:qwe(${index})">${index}</a>
            </c:forEach>
            <a href="javaScript:qwe(${pageInfo.isLastPage?pageInfo.pages:pageInfo.nextPage})">下一页</a>
            <a href="javaScript:qwe(${pageInfo.pages})">尾页</a>
            <input type="button" value="添加(管理员身份)" onclick="addGLY()">
        </td>
    </tr>
</table>
</body>
</html>
<script>
    function qwe(pageNum) {
        $("[name='pageNum']").val(pageNum)
        $("form").submit()
    }
    function addGLY() {
        location="toaddgly.do"
    }
    function qx(rid) {
        $.ajax({
            url:"updateByRid.do",
            data:{rid:rid},
            type:"post",
            dataType:"json",
            success:function (obj) {
                if (obj>0){
                    location="list.do"
                }
            }
        })
    }

</script>
